var express = require('express');
var router = express.Router();
const rp = require("request-promise"); //将文件在当前js文件中进行关联
const jwt = require("jsonwebtoken");
const { getEncAse192 } = require("../utils/salt");

/* GET users listing. */
// 新增用户

router.post('/add', async function(req, res, next) {
   console.log(1)
   console.log()
   res.send(1)
})
router.post('/addNewAccount', async function(req, res, next) {
  console.log(req.body);
  const{ password } = req.body;
  console.log(password);
  const newPassword = getEncAse192(password, "73");
  let conclusion = await rp({
    method: "POST",
		uri: "http://localhost:8080/users/register",
		body: {
			...req.body, password: newPassword
		},
		json: true
  });
  res.send(conclusion);
});

module.exports = router;
